package com.example.cloudsampleconsumer.service;

import com.example.cloudsampleconsumer.model.TestModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Component
@FeignClient(value = "cloud-sample-provider", fallback = CloudSampleProviderFallBackService.class)
public interface CloudSampleProviderService {

    @RequestMapping(value = "/sayHello", method = RequestMethod.GET)
    String sayHello();

    @RequestMapping(value = "/model/{id}", method = RequestMethod.GET)
    Object getById(@PathVariable("id") Integer id);

    @RequestMapping(value = "/model/save")
    boolean save(@RequestBody TestModel testModel);

}
